package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppBenchmarkManagement;
import com.ep.modules.app.service.AppBenchmarkManagementService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/benchmark_management")
public class AppBenchmarkManagementController {
    @Autowired
    private AppBenchmarkManagementService appBenchmarkManagementService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appBenchmarkManagementService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppBenchmarkManagement appbenchmarkmanagement = appBenchmarkManagementService.getById(id);
        return R.ok().put("appbenchmarkmanagement", appbenchmarkmanagement);
    }

    @SysLog("保存AppBenchmarkManagement")
    @PostMapping("/save")
    public R save(@RequestBody AppBenchmarkManagement appbenchmarkmanagement) {
        ValidatorUtils.validateEntity(appbenchmarkmanagement);
        appBenchmarkManagementService.save(appbenchmarkmanagement);
        return R.ok();
    }

    @SysLog("修改AppBenchmarkManagement")
    @PostMapping("/update")
    public R update(@RequestBody AppBenchmarkManagement appbenchmarkmanagement) {
        ValidatorUtils.validateEntity(appbenchmarkmanagement);
        appBenchmarkManagementService.update(appbenchmarkmanagement);
        return R.ok();
    }

    @SysLog("删除AppBenchmarkManagement")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appBenchmarkManagementService.deleteBatch(ids);
        return R.ok();
    }
}